<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
    <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
    </div>
    <div id="community">
        <div id="forum-header">
            <?php echo $community_header; ?>
        </div>
        <div id="community-tabs" class="htabs" style="background:url('catalog/view/theme/default/image/general/icon_beta.png') no-repeat 155px center;"><a href="#tab-lottery"><?php echo $tab_lottery; ?></a><a href="#tab-prize"><?php echo $tab_prize; ?></a></div>
        <div id="tab-lottery" class="tab-content">
            <div style="float:right;">
                <span style="float:left;margin-right:30px;"><fb:like ref="micbus.com" href="<?php echo $snslink; ?>" send="true" layout="button_count" width="450" show_faces="false" font="lucida grande"></fb:like></span>
                <span style="float:left;"><a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo $snslink; ?>"  data-via="MicbusFan" data-text="<?php echo $your_day_social_title; ?>" data-count="horizontal">Tweet</a></span>
                <span style="float:left;"><g:plusone size="medium" href="<?php echo $snslink; ?>"></g:plusone></span>
            </div>
            <div style="clear:both;"></div>
            <div id="lottery">
                <span><?php echo $text_lottery_help; ?></span>
                <ul id="prize">
                    <li class="red" title="<?php echo $text_click_draw; ?>">1</li>
                    <li class="green"  title="<?php echo $text_click_draw; ?>">2</li>
                    <li class="blue"  title="<?php echo $text_click_draw; ?>">3</li>
                    <li class="purple"  title="<?php echo $text_click_draw; ?>">4</li>
                    <li class="olive"  title="<?php echo $text_click_draw; ?>">5</li>
                    <li class="pink"  title="<?php echo $text_click_draw; ?>">6</li>
                    <li class="brown"  title="<?php echo $text_click_draw; ?>">7</li>
                    <li class="darkorange"  title="<?php echo $text_click_draw; ?>">8</li>
                    <li class="darkcyan"  title="<?php echo $text_click_draw; ?>">9</li>
                </ul>
                <div id="lottery-buttons"><a href="javascript:void(0)" id="viewother"><?php echo $text_reveal_others; ?></a><a href="javascript:void(0);" id="repeat"><?php echo $text_try_again; ?></a></div>
                <div id="data"></div>
            </div>
            <div id="winner">
                <span><?php echo $text_latest_winners; ?></span>
                <ul>
                    <?php foreach ($winners as $winner) { ?>
                    <li>
                        <a href="<?php echo $winner['user_link']; ?>"><?php echo $winner['user_name']; ?></a> <?php echo $text_win; ?><br />
                        <?php echo $winner['prize']; ?>
                    </li>
                    <?php } ?>
                </ul>
            </div>
        </div>
        <div id="tab-prize" class="tab-content">
            <?php foreach($prizes as $key => $prize){ ?>
            <div class="<?php echo $key<3 ? 'pic' : 'text' ?>">
                <strong><?php echo $prize['id']; ?></strong><br />
                <?php echo $prize['prize']; ?>
            </div>
            <?php } ?>
        </div>
        <div style="clear:both;"></div>
        <div>
            <span style="font-weight:bold;font-size:14px;">Note: Although we check the facebook comments on this page frequently, we cannot guaranteed to answer every question posted here.If you have any questions, we recommend clicking <a href="<?php echo $contact_link; ?>">here</a> to contact us.</span><br /><br />
            <fb:comments href="http://www.micbus.com/index.php?route=community/yourday" num_posts="1" width="980"></fb:comments>
        </div>
    </div>
<script  data-cfasync="true" type="text/javascript" src="catalog/view/javascript/jquery/jquery.flip.min.js"></script>
<script data-cfasync="true" type="text/javascript">
    $('#community-tabs a').tabs();

    $(function(){
        var submit = false;
        $("#prize li").each(function(){
            var p = $(this);
            var c = $(this).attr('class');
            p.css("background-color",c);
            p.click(function(){
                if(submit){
                    return false;
                }

                $.ajax({
                    type:'GET',
                    url:'index.php?route=community/lottery/result&code=' + encodeURIComponent($('input[name=\'verify\']').val()),
                    dataType:'json',
                    cache:false,
                    success:function(data){
                        if (data.error) {
                            $('#lottery').before('<div class="warning" style="clear:both;">' + data.error + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
                        }

                        if (data.success) {
                            var prize = data.success.yes;
                            p.flip({
                                direction:'rl',
                                content:prize,
                                color:c,
                                onBefore: function(){
                                    $("#prize li").unbind('click').css("cursor","default").removeAttr("title");
                                },
                                onEnd: function(){
                                    p.css({"font-size":"14px","line-height":"16px","padding-top":"20px","height":"100px"});
                                    p.attr("id","r");
                                    $("#viewother").show();
                                    $('#lottery').before('<div class="success" style="clear:both;">' + data.success.text + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
                                }
                            });
                            $("#data").data("nolist",data.success.no);
                        }

                        $('html, body').animate({ scrollTop: 240 }, 'slow');
                    }
                });

                submit = true;
            });
        });
        $("#viewother").click(function(){
            var mydata = $("#data").data("nolist"); //获取数据
            var mydata2 = eval(mydata);

            $("#prize li").not($('#r')[0]).each(function(index){
                var pr = $(this);
                pr.flip({
                    direction:'bt',
                    color:'lightgrey',
                    content:mydata2[index],
                    onEnd:function(){
                        pr.css({"font-size":"14px","line-height":"16px","padding-top":"20px","height":"100px","color":"#333"});
                        $("#viewother").hide();
                        $("#repeat").show();
                    }
                });
            });
            $("#data").removeData("nolist");
        });
        $("#repeat").click(function(){
            window.location.reload();
        });
    });
</script>
<script  data-cfasync="true" type="text/javascript"><!--
$('#community input[name=\'header-keyword\']').keydown(function(e) {
    if (e.keyCode == 13) {
        $('#header-search-button').trigger('click');
    }
});

$('#header-search-button').bind('click', function() {
    url = 'index.php?route=community/search';

    var keyword = $('#forum-header-bar-search input[name=\'header-keyword\']').attr('value');

    url += '&kw=' + encodeURIComponent(keyword) + '&sw=psm&sb=lpt&or=desc&lr=all';

    location = url;
});
//--></script>
<script data-cfasync="true" type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<script data-cfasync="true" type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<div id="fb-root" style="display:inline;"></div>
<script data-cfasync="true" >(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=178458855569974";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script  data-cfasync="true" type="text/javascript" src="catalog/view/javascript/forum_fn.js"></script>
<script data-cfasync="true" type="text/javascript"><!--
<?php for($i=0;$i<3;$i++){ ?>
$('.popup<?php echo $i; ?>').colorbox({
    overlayClose: true,
    opacity: 0.5
});
<?php } ?>
//--></script>
<?php  echo $footer; ?>
